package ru.rchervot.sanasar.client.view;

import ru.rchervot.sanasar.client.view.Presenter.Display;

import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class FactorySearchHistoryViewCandidates
implements FactorySearchHistoryView {
	private final HandlerManager eventBus;
	
	@Inject
	public FactorySearchHistoryViewCandidates(
			HandlerManager eventBus) {
		this.eventBus = eventBus;
	}

	@Override
	public Display build() {
		return (Display)getHistoryView();
	}
	
	private ContentHistoryCandidatesView historyView;
	private Widget getHistoryView() {
		if (historyView == null) {
			historyView = new ContentHistoryCandidatesView();
			ContentHistoryCandidatesPresenter p = 
				new ContentHistoryCandidatesPresenter(historyView, eventBus);
			p.bindDisplay();
		}
		
		return historyView;
	}
}
